/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package za.co.pas.spaceandtime.data;

import za.co.pas.business.data.GenericData;
import java.io.Serializable;
import javax.persistence.Entity;

/**
 * Max capacity is only an indication. Actual max capacity is stored in room
 * @author alabuschagne
 */
@Entity
public class BedType extends GenericData implements Serializable
{

    private static final long serialVersionUID = 1L;
    private Integer maxCapacity;
    private Boolean approved;


    @Override
    public boolean equals(Object object)
    {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof BedType))
        {
            return false;
        }
        BedType other = (BedType) object;
        if ((this.id == null && other.id != null) || (this.id != null && !this.id.equals(other.id)))
        {
            return false;
        }
        return true;
    }

    @Override
    public int hashCode()
    {
        return super.hashCode();
    }
    
    @Override
    public BedType clone()
    {
        BedType newBedType = new BedType();
        newBedType.setDescription(description);
        newBedType.setId(id);
        newBedType.setName(name);
        return newBedType;
    }

    /**
     * @return the maxCapacity
     */
    public Integer getMaxCapacity()
    {
        return maxCapacity;
    }

    /**
     * @param maxCapacity the maxCapacity to set
     */
    public void setMaxCapacity(Integer maxCapacity)
    {
        this.maxCapacity = maxCapacity;
    }

    public boolean check(BedType other)
    {
        if(!super.check(other))
        {
            return false;
        }
        return maxCapacity.compareTo(other.getMaxCapacity()) == 0;
    }

    /**
     * @return the approved
     */
    public Boolean getApproved()
    {
        return approved;
    }

    /**
     * @param approved the approved to set
     */
    public void setApproved(Boolean approved)
    {
        this.approved = approved;
    }
}
